
using System;
using System.Collections.Generic;
using Abp.Application.Services;
using L._52ABP.Application.Dtos;
using L._52ABP.Common.Extensions.Enums;

using Yozeev.DataExporting.Excel.Epplus;
using Yozeev.DataFileObjects.DataTempCache;
using Yozeev.BusinessLogic.Dtos;


namespace Yozeev.BusinessLogic.Exporting
{
    /// <summary>
    /// 的视图模型根据业务需要可以导出为Excel文件
    /// </summary>
	[RemoteService(IsEnabled = false)]
    public class CommonCustomerListExcelExporter : EpplusExcelExporterBase, ICommonCustomerListExcelExporter
    {       
        /// <summary>
        /// 构造函数，需要继承父类
        /// </summary>
        /// <param name="dataTempFileCacheManager"></param>
        public CommonCustomerListExcelExporter(IDataTempFileCacheManager dataTempFileCacheManager):base(dataTempFileCacheManager)
        {

        }
        public FileDto ExportToExcelFile(List<CommonCustomerListDto> commonCustomerListDtos)
        {

    var fileExportName = L("CommonCustomerList") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";

            var excel =
                 CreateExcelPackage("fileExportName", excelpackage =>
               {
                   var sheet = excelpackage.Workbook.Worksheets.Add(L("CommonCustomers"));

                   sheet.OutLineApplyStyle = true;
			AddHeader(sheet,L("MainCustomerId"),L("ViceCustomerId"),L("ViceCustomer"),L("CommonCustomerCustomerName"),L("CommonCustomerMobile"),L("Sex"),L("CommonCustomerCertificatesNum"),L("VerifiableType"));
            AddObject(sheet, 2, commonCustomerListDtos
             ,ex => ex.MainCustomerId 
             ,ex => ex.ViceCustomerId 
             ,ex => ex.ViceCustomer 
             ,ex => ex.CustomerName 
             ,ex => ex.Mobile 
             ,ex => ex.Sex 
             ,ex => ex.CertificatesNum 
			,ex => ex.VerifiableType
                   );

							//// custom codes
									
							

							//// custom codes end
	  });
    return excel;
        }
    }
}
